import Vue from 'vue'
import VueRouter from 'vue-router';

Vue.use(VueRouter);

// 导入对应的路由组件
import HomeContainer from './components/tabbar/HomeContainer.vue'
import MemberContainer from './components/tabbar/MemberContainer.vue'
import ShopcarContainer from './components/tabbar/ShopcarContainer.vue'
import SearchContainer from './components/tabbar/SearchContainer.vue'
import newsList from './components/news/newsList.vue'
import newsInfo from './components/news/newsInfo.vue'
import photoList from './components/photos/PhotoList.vue'
import ProtoInfo from './components/photos/PhotoInfo.vue'

// 创建路由对象
var router = new VueRouter({
    routes: [   // 配置路由规则
        {path: '/', redirect: '/home'},
        {path: '/home', component: HomeContainer},
        {path: '/member', component: MemberContainer},
        {path: '/shopcar', component: ShopcarContainer},
        {path: '/search', component: SearchContainer},
        {path: '/home/newslist', component: newsList},
        {path: '/home/newsinfo/:id', component: newsInfo},
        {path: '/home/photolist', component: photoList},
        {path: '/home/photoinfo/:id', component: ProtoInfo}
    ],
    linkActiveClass: 'mui-active'
});

// 把路由对象暴露出去
export default router